Modding
Wish to create your own content for Hospitalize, AND share it with others? Modding with let you do just that! Creating mods can be done by anyone, no matter your programatic background. Using a simple language called XML, you will be able to change almost anything in the game and implement your very own creations. From character behaviour to diseases and treatments. Hospitalize Vanilla Content *In order to greater understand the XML coding in Hospitalize, we have released the original Hospitalize XML files for you to download. *There will be more documentation surrounding this in the future, but at least releasing it publicly, anyone can see how Illeris has set up their XML code and use it as reference for their own creations! *You can download a zip file containing all the XML files here. Getting Started: Tutorial *To get started with creating your own mod, you first need to create a folder with some files in it. Start out by navigating to your Hospitalize install location. (That is the folder containing Hospitalize.exe. The default location is "'C:\Program Files (x86)\Steam\steamapps\common\Hospitalize'") *Once there, navigate to "Hospitalize_Data/StreamingAssets/Mods". This is where you want to put your mod folder. Let's create a new folder and call it whatever you want. In this example, we will be creating the grim reaper, so we are going to call the folder "The Grim Reaper". Open the folder you just created. Next, open your text editor of choice. (In this guide, we will be using Notepad++.) Create a new file in your text editor, and add the following: (Save this file as "'mod.data")'' *Now we need to actually create the grim reaper and all of its uses. To begin with, create a new file in your text editor and save it as "modContent.xml" in the SAME directory as your "mod.data" file. The "modContent.xml" file will contain all of the grim reaper's actions and attributes. Let's start filling that in. *Begin by creating a resource node with the name of your mod. Within this node, you can start setting up essential assets to your mod like sounds, graphics, etc. Let's try setting up a texture for our grim reaper by adding the "texturemap" node. In our case, it would look somthing like this: Note that you actually need to have the png file in your mod folder. You can choose to create your own texture or simply use the one I created: *Next, create a new node to put your character data in, like so: Let's start by giving our new character a name using the "name" node. In our case, it would look something like this: *Now, let's add some definitions as to what this character actually is. For this, we will use a couple of nodes. You might ask yourself "What is an entity?". In Hospitalize, an "entity" is a character that is '''not spawnable by traditional means (Though the hiring menu for example.). Our "Grim Reaper" is not spawned via the hiring menu and so it is indeed an "entity". In addition, we will need to add the "frequency" node to make sure there is actually a chance for our "Grim Reaper" to spawn. And so, in our case, these nodes should look something like this: (Keep in mind this is from 0-1 as stated above.) *Next, we will add a couple more nodes to define what the player can do with this character. In this case, we want all of the fields above to be false. *Now, let's actually give our character some graphics. To do this, we first need to load a sprite for our character by using the "sprite" node. sprite - The name of this sprite (string) textureMap - The name of the texture map you want to use for this sprite (string) mapLocation - The location and dimensions of the sprite on the character sheet starting in the bottom left corner (x;y;w;h) unitToPixel - A scale factor. The default for hospitalize is 192. (int) offset - The offset of the sprite to the center of the character. (x;y;z) In our case, it would look somthing like this: *Next, we need to tell the character which sprite to use depending on the direction he is facing. We do this by adding "objectview" nodes. objectview - The name of this view, following a specific naming pattern. dir - The direction this view is for (n/e/s/w) sprite - The sprite to use for this direction footprint - 16 bits, representing a 4x4 grid, which defines which part of this object obstruct pathfinding. (0000000000000000) flipxaxis - Flip the sprite on the X axis (true/false) flipyaxis - Flip the sprite on the Y axis (true/false) transparency - The transparency of this object view (0 - 1) The naming convention for the objectview is as follows: BODYPART_KEYWORD_DIRECTION. The bodypart is either "body" or "head". The keyword is "normal" by default. The player can add more keywords to toggle different states of the sprite, e.g. the cleaner sweeping the floor. The direction refers to the direction of this object view. *Let's add 4 of these object views to account for all 4 directions a character can move. Note that we only have one sprite for the reaper, but in theory you could create an individual sprite for each direction. Your entire code should at this point look somewhat like this: At this point, you can go ahead and test your mod. For testing purposes, you should increase the spawning frequency to something higher like 1. Start up your game, and go into the mods menu. If everything went well, your mod should show up in the list and you should be able to tick the check box next to it. After pressing the "back" button, the game will reload and your mod is enabled. Upon starting a new game, you should now see your grim reapers spawn. Great! The reaper is in the game! However, he doesn't really do much yet.. Let's try to add some functionality to our reaper! To do that, we need to create a task for him. Start by creating a new node under your "ReaperChar" node. [ ... ] ' ' ' *Now, just like we did for the reaper, we need to specify a name for this blueprint, and some extra nodes telling the game what this blueprint is. In this case, a task. Our task should now look like this: We set "personalTask" to false, since there is no personal reason we need this task to cover. *In order for our task to actually do anything, we need to add some actions to tell the game what to do. Note that this is a very basic example. (See the documentation page for Actions for more info.) action - The action to execute. nr - The index of this action. Leave this as auto. primary, secondary and tertiary - Three variables to pass into this action text - The text that will be shown as the current activity pre - What action needs to be finished for this to execute. Leave this as auto. In this example, I will be using 6 simple actions to create the reaper's behaviour. GetClosestPatient - Gets the patient closest to the task owner Move - Move Object A to location B Delay - Wait for a bit KillCharacter - Kill the closest character we found earlier MoveToRandomSpotInWorld - Move somehwere on the map RemoveCharacter - Remove the reaper from existence. In this example, my actions look something like this: *Finally, let's add a line to our ReaperChar node. This tells our reaper to automatically go and reap souls of unknowing victims! *Your entire "'''''modContent.xml" file should now look something like this: With all of this completed, The Grim Reaper should now be flying around, killing innocent patients, before disappearing into the Aether again. Sharing your own mods: * Move your mod folder from the "StreamingAssets/Mods" folder to some other directory. * Open Hospitalize. * In the main menu, navigate to the "Mods -> Workshop" menu. * Click the "Create new item" button. * For the source folder, navigate into your mod folder (To the same directory where your mod.data is located) * Enter a title for your mod. * Optionally select an image, enter a description and change visability settings for your mod. * Hit the "Submit" button. * Congratulations! You can now subscribe to your mod from the Steam Workshop page. After restarting Hospitalize, your mod should be ready to go! Mod Examples Mod Example One: Usable Object The Big Chair mod is very simple and is just an extra chair to your hospital. It is a furniture object and can be used by patients '''and '''staff alike. (If you haven't already, it's '''strongly '''recommended that you read the tutorial section before looking at this code if you aren't familiar with it.) The "mod.data" file for the Big Chair looks like this: The "modContent.xml" file looks like this: (In XML, lines between are comments and will not affect the code in any way, they are simply a way to keep track of what does what) In this example, nodes that weren't used in the modding tutorial is demonstrated. There are many of them in Hospitalize'', ''all for the purpose of being as modable as possible. There will be a documentation page up for all the different nodes in the near future. Mod Example Two: Decorative Object The Red Oak mod is another very simple mod. It's an additional tree to the already excisting bunch. As this is just a decorative object, the XML file is very simple and you could use this same XML file for reference if you wish to add your own decorative objects. Keep in mind that some of the nodes used here are explicitly for Trees. (If you haven't already, it's '''strongly '''recommended that you read the tutorial section before looking at this code if you aren't familiar with it.) The "mod.data" file for the Red Oak looks like this: The "modContent.xml" file looks like this: (In XML, lines between are comments and will not affect the code in any way, they are simply a way to keep track of what does what) Mod Example Three: Scope Template The ENT template is a scope template' '''created through modding. You will be able to make your own templates through modding by following this example. The templates require little to no code at all, so it's very simple. The "'mod.data'" for the '''ENT template '''looks like this: The "'modContent.xml'" file looks like this: ''(In XML, lines between are comments and will not affect the code in any way, they are simply a way to keep track of what does what) Mod Example Four: Disease and Treatment Making diseases is a little more complicated and requires you to look up the correct Actions. In this example, Migraine, you can see how to setup a working disease and a corresponding treatment. The "mod.data" file for Migraine 'looks like this: The "'modContent.xml" looks like this: (Keep in mind that the XML files are '''quite sensitive' and you will need to make sure to have your quotation marks and closing brackets just like in this example, or it will throw you errors.)'' As you can see, it requires a lot more code than objects ''or ''templates. In the Actions documentation you will find exactly what an action does and what its parameters need to be. Primary, secondary ''and ''tertiary ''are always specified in the Actions documentation. ''(It is your friend!) Mod Example Five: Decorative Object